﻿<Button @onclick="@OnClick">点击打开 Dialog</Button>

<Dialog></Dialog>

@code {
    /// <summary>
    /// 获得 DialogService 实例
    /// </summary>
    [Inject]
    private DialogService? DialogService { get; set; }

    /// <summary>
    /// 点击按钮调用 Dialog 服务
    /// </summary>
    /// <returns></returns>
    private Task OnClick()
    {
        DialogService?.Show(new DialogOption()
        {
            Title = "自带的 Counter 组件",
            KeepChildrenState = KeepState,
            Component = DynamicComponent.CreateComponent<Counter>()
        });
        return Task.CompletedTask;
    }
}
